<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
                      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
    <title>Serializing LDAP data to and from LDIF - Zend Framework Manual</title>

    <link href="../css/shCore.css" rel="stylesheet" type="text/css" />
    <link href="../css/shThemeDefault.css" rel="stylesheet" type="text/css" />
    <link href="../css/styles.css" media="all" rel="stylesheet" type="text/css" />
</head>
<body>
<h1>Zend Framework</h1>
<h2>Programmer's Reference Guide</h2>
<ul>
    <li><a href="../en/zend.ldap.ldif.html">Inglês (English)</a></li>
    <li><a href="../pt-br/zend.ldap.ldif.html">Português Brasileiro (Brazilian Portuguese)</a></li>
</ul>
<table width="100%">
    <tr valign="top">
        <td width="85%">
            <table width="100%">
                <tr>
                    <td width="25%" style="text-align: left;">
                    <a href="zend.ldap.server.html">Getting information from the LDAP server</a>
                    </td>

                    <td width="50%" style="text-align: center;">
                        <div class="up"><span class="up"><a href="zend.ldap.html">Zend_Ldap</a></span><br />
                        <span class="home"><a href="manual.html">Programmer's Reference Guide</a></span></div>
                    </td>

                    <td width="25%" style="text-align: right;">
                        <div class="next" style="text-align: right; float: right;"><a href="zend.loader.html">Zend_Loader</a></div>
                    </td>
                </tr>
            </table>
<hr />
<div id="zend.ldap.ldif" class="section"><div class="info"><h1 class="title">Serializing LDAP data to and from LDIF</h1></div>
    

    <div class="section" id="zend.ldap.ldif.encode"><div class="info"><h1 class="title">Serialize a LDAP entry to LDIF</h1></div>
        

        <pre class="programlisting brush: php">
$data = array(
    &#039;dn&#039;                         =&gt; &#039;uid=rogasawara,ou=営業部,o=Airius&#039;,
    &#039;objectclass&#039;                =&gt; array(&#039;top&#039;,
                                          &#039;person&#039;,
                                          &#039;organizationalPerson&#039;,
                                          &#039;inetOrgPerson&#039;),
    &#039;uid&#039;                        =&gt; array(&#039;rogasawara&#039;),
    &#039;mail&#039;                       =&gt; array(&#039;rogasawara@airius.co.jp&#039;),
    &#039;givenname;lang-ja&#039;          =&gt; array(&#039;ロドニー&#039;),
    &#039;sn;lang-ja&#039;                 =&gt; array(&#039;小笠原&#039;),
    &#039;cn;lang-ja&#039;                 =&gt; array(&#039;小笠原 ロドニー&#039;),
    &#039;title;lang-ja&#039;              =&gt; array(&#039;営業部 部長&#039;),
    &#039;preferredlanguage&#039;          =&gt; array(&#039;ja&#039;),
    &#039;givenname&#039;                  =&gt; array(&#039;ロドニー&#039;),
    &#039;sn&#039;                         =&gt; array(&#039;小笠原&#039;),
    &#039;cn&#039;                         =&gt; array(&#039;小笠原 ロドニー&#039;),
    &#039;title&#039;                      =&gt; array(&#039;営業部 部長&#039;),
    &#039;givenname;lang-ja;phonetic&#039; =&gt; array(&#039;ろどにー&#039;),
    &#039;sn;lang-ja;phonetic&#039;        =&gt; array(&#039;おがさわら&#039;),
    &#039;cn;lang-ja;phonetic&#039;        =&gt; array(&#039;おがさわら ろどにー&#039;),
    &#039;title;lang-ja;phonetic&#039;     =&gt; array(&#039;えいぎょうぶ ぶちょう&#039;),
    &#039;givenname;lang-en&#039;          =&gt; array(&#039;Rodney&#039;),
    &#039;sn;lang-en&#039;                 =&gt; array(&#039;Ogasawara&#039;),
    &#039;cn;lang-en&#039;                 =&gt; array(&#039;Rodney Ogasawara&#039;),
    &#039;title;lang-en&#039;              =&gt; array(&#039;Sales, Director&#039;),
);
$ldif = Zend_Ldap_Ldif_Encoder::encode($data, array(&#039;sort&#039; =&gt; false,
                                                    &#039;version&#039; =&gt; null));
/*
$ldif contains:
dn:: dWlkPXJvZ2FzYXdhcmEsb3U95Za25qWt6YOoLG89QWlyaXVz
objectclass: top
objectclass: person
objectclass: organizationalPerson
objectclass: inetOrgPerson
uid: rogasawara
mail: rogasawara@airius.co.jp
givenname;lang-ja:: 44Ot44OJ44OL44O8
sn;lang-ja:: 5bCP56yg5Y6f
cn;lang-ja:: 5bCP56yg5Y6fIOODreODieODi+ODvA==
title;lang-ja:: 5Za25qWt6YOoIOmDqOmVtw==
preferredlanguage: ja
givenname:: 44Ot44OJ44OL44O8
sn:: 5bCP56yg5Y6f
cn:: 5bCP56yg5Y6fIOODreODieODi+ODvA==
title:: 5Za25qWt6YOoIOmDqOmVtw==
givenname;lang-ja;phonetic:: 44KN44Gp44Gr44O8
sn;lang-ja;phonetic:: 44GK44GM44GV44KP44KJ
cn;lang-ja;phonetic:: 44GK44GM44GV44KP44KJIOOCjeOBqeOBq+ODvA==
title;lang-ja;phonetic:: 44GI44GE44GO44KH44GG44G2IOOBtuOBoeOCh+OBhg==
givenname;lang-en: Rodney
sn;lang-en: Ogasawara
cn;lang-en: Rodney Ogasawara
title;lang-en: Sales, Director
*/
</pre>

    </div>

    <div class="section" id="zend.ldap.ldif.decode"><div class="info"><h1 class="title">Deserialize a LDIF string into a LDAP entry</h1></div>
        

        <pre class="programlisting brush: php">
$ldif = &quot;dn:: dWlkPXJvZ2FzYXdhcmEsb3U95Za25qWt6YOoLG89QWlyaXVz
objectclass: top
objectclass: person
objectclass: organizationalPerson
objectclass: inetOrgPerson
uid: rogasawara
mail: rogasawara@airius.co.jp
givenname;lang-ja:: 44Ot44OJ44OL44O8
sn;lang-ja:: 5bCP56yg5Y6f
cn;lang-ja:: 5bCP56yg5Y6fIOODreODieODi+ODvA==
title;lang-ja:: 5Za25qWt6YOoIOmDqOmVtw==
preferredlanguage: ja
givenname:: 44Ot44OJ44OL44O8
sn:: 5bCP56yg5Y6f
cn:: 5bCP56yg5Y6fIOODreODieODi+ODvA==
title:: 5Za25qWt6YOoIOmDqOmVtw==
givenname;lang-ja;phonetic:: 44KN44Gp44Gr44O8
sn;lang-ja;phonetic:: 44GK44GM44GV44KP44KJ
cn;lang-ja;phonetic:: 44GK44GM44GV44KP44KJIOOCjeOBqeOBq+ODvA==
title;lang-ja;phonetic:: 44GI44GE44GO44KH44GG44G2IOOBtuOBoeOCh+OBhg==
givenname;lang-en: Rodney
sn;lang-en: Ogasawara
cn;lang-en: Rodney Ogasawara
title;lang-en: Sales, Director&quot;;
$data = Zend_Ldap_Ldif_Encoder::decode($ldif);
/*
$data = array(
    &#039;dn&#039;                         =&gt; &#039;uid=rogasawara,ou=営業部,o=Airius&#039;,
    &#039;objectclass&#039;                =&gt; array(&#039;top&#039;,
                                          &#039;person&#039;,
                                          &#039;organizationalPerson&#039;,
                                          &#039;inetOrgPerson&#039;),
    &#039;uid&#039;                        =&gt; array(&#039;rogasawara&#039;),
    &#039;mail&#039;                       =&gt; array(&#039;rogasawara@airius.co.jp&#039;),
    &#039;givenname;lang-ja&#039;          =&gt; array(&#039;ロドニー&#039;),
    &#039;sn;lang-ja&#039;                 =&gt; array(&#039;小笠原&#039;),
    &#039;cn;lang-ja&#039;                 =&gt; array(&#039;小笠原 ロドニー&#039;),
    &#039;title;lang-ja&#039;              =&gt; array(&#039;営業部 部長&#039;),
    &#039;preferredlanguage&#039;          =&gt; array(&#039;ja&#039;),
    &#039;givenname&#039;                  =&gt; array(&#039;ロドニー&#039;),
    &#039;sn&#039;                         =&gt; array(&#039;小笠原&#039;),
    &#039;cn&#039;                         =&gt; array(&#039;小笠原 ロドニー&#039;),
    &#039;title&#039;                      =&gt; array(&#039;営業部 部長&#039;),
    &#039;givenname;lang-ja;phonetic&#039; =&gt; array(&#039;ろどにー&#039;),
    &#039;sn;lang-ja;phonetic&#039;        =&gt; array(&#039;おがさわら&#039;),
    &#039;cn;lang-ja;phonetic&#039;        =&gt; array(&#039;おがさわら ろどにー&#039;),
    &#039;title;lang-ja;phonetic&#039;     =&gt; array(&#039;えいぎょうぶ ぶちょう&#039;),
    &#039;givenname;lang-en&#039;          =&gt; array(&#039;Rodney&#039;),
    &#039;sn;lang-en&#039;                 =&gt; array(&#039;Ogasawara&#039;),
    &#039;cn;lang-en&#039;                 =&gt; array(&#039;Rodney Ogasawara&#039;),
    &#039;title;lang-en&#039;              =&gt; array(&#039;Sales, Director&#039;),
);
*/
</pre>

    </div>
</div>
        <hr />

            <table width="100%">
                <tr>
                    <td width="25%" style="text-align: left;">
                    <a href="zend.ldap.server.html">Getting information from the LDAP server</a>
                    </td>

                    <td width="50%" style="text-align: center;">
                        <div class="up"><span class="up"><a href="zend.ldap.html">Zend_Ldap</a></span><br />
                        <span class="home"><a href="manual.html">Programmer's Reference Guide</a></span></div>
                    </td>

                    <td width="25%" style="text-align: right;">
                        <div class="next" style="text-align: right; float: right;"><a href="zend.loader.html">Zend_Loader</a></div>
                    </td>
                </tr>
            </table>
</td>
        <td style="font-size: smaller;" width="15%"> <style type="text/css">
#leftbar {
	float: left;
	width: 186px;
	padding: 5px;
	font-size: smaller;
}
ul.toc {
	margin: 0px 5px 5px 5px;
	padding: 0px;
}
ul.toc li {
	font-size: 85%;
	margin: 1px 0 1px 1px;
	padding: 1px 0 1px 11px;
	list-style-type: none;
	background-repeat: no-repeat;
	background-position: center left;
}
ul.toc li.header {
	font-size: 115%;
	padding: 5px 0px 5px 11px;
	border-bottom: 1px solid #cccccc;
	margin-bottom: 5px;
}
ul.toc li.active {
	font-weight: bold;
}
ul.toc li a {
	text-decoration: none;
}
ul.toc li a:hover {
	text-decoration: underline;
}
</style>
 <ul class="toc">
  <li class="header home"><a href="manual.html">Programmer's Reference Guide</a></li>
  <li class="header up"><a href="manual.html">Programmer's Reference Guide</a></li>
  <li class="header up"><a href="reference.html">Zend Framework Reference</a></li>
  <li class="header up"><a href="zend.ldap.html">Zend_Ldap</a></li>
  <li><a href="zend.ldap.introduction.html">Introduction</a></li>
  <li><a href="zend.ldap.api.html">API overview</a></li>
  <li><a href="zend.ldap.usage.html">Usage Scenarios</a></li>
  <li><a href="zend.ldap.tools.html">Tools</a></li>
  <li><a href="zend.ldap.node.html">Object oriented access to the LDAP tree using Zend_Ldap_Node</a></li>
  <li><a href="zend.ldap.server.html">Getting information from the LDAP server</a></li>
  <li class="active"><a href="zend.ldap.ldif.html">Serializing LDAP data to and from LDIF</a></li>
 </ul>
 </td>
    </tr>
</table>

<script type="text/javascript" src="../js/shCore.js"></script>
<script type="text/javascript" src="../js/shAutoloader.js"></script>
<script type="text/javascript" src="../js/main.js"></script>

</body>
</html>